<extend name="Public/base"/>

<block name="body">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title">
        <h2>{$meta_title}</h2>
    </div>
    <form action="{:U('edit')}" method="post" class="form-horizontal">
        <input type="hidden" name="jid" value="{$data['judge_id']}"/>
        <div class="form-item">
            <label class="item-label">姓名<span class="check-tips">（必填项）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="judge_name" value="{$data['judge_name']}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">性别</label>
            <div class="controls">
                <select name="sex">
                    <option value="0" <eq name="data['sex']" value="0"> selected </eq>>女</option>
                    <option value="1" <eq name="data['sex']" value="1"> selected </eq>>男</option>
                </select>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">职业<span class="check-tips">（必填项）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="job" value="{$data['job']}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">手机号<span class="check-tips">（必填项）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="phone" value="{$data['phone']}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">所在地<span class="check-tips">（必填项）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="address" value="{$data['address']}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">资质</label>
            <div class="controls">
                <select name="zizhi_id">
                   <volist name="zizhiList" id="vo">
                        <option value="{$vo.zizhi_id}" <eq name="data['zizhi_id']" value="$vo['zizhi_id']"> selected </eq>>{$vo.title}</option>
                    </volist>
                </select>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">资质ID<span class="check-tips">（选填）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="zizhi_no" value="{$data['zizhi_no']}">
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">照片<span class="check-tips">（必填项）</span></label>
            <div class="controls">
                <input type="file" id="upload_picture_face">
                <input type="hidden" name="judge_face" id="cover_id_face" value="{$data['judge_face']}"/>
                <div class="upload-img-box">
                    <notempty name="data['judge_face']">
                        <div class="upload-pre-item"><img src="{$data['judge_face']}"/></div>
                    </notempty>
                </div>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">裁判履历<span class="check-tips">（必填项）</span></label>
            <div class="controls">
                <label class="textarea input-large"><textarea  class="text input-large" name="judge_desc" >{$data['judge_desc']}</textarea></label>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">其他说明<span class="check-tips">（必填项）</span></label>
            <div class="controls">
                <label class="textarea input-large"><textarea class="text input-large" name="other_desc" >{$data['other_desc']}</textarea></label>
            </div>
        </div>
        <div class="form-item">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1); return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    <script type="text/javascript">
        //导航高亮
        highlight_subnav("{:U('Teacher/index')}");
    </script>
    <script type="text/javascript">
        //上传图片
        /* 初始化上传插件 */
        $("#upload_picture_face").uploadify({
            "height": 30,
            "swf": "__STATIC__/uploadify/uploadify.swf",
            "fileObjName": "download",
            "buttonText": "上传图片",
            "uploader": "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
            "width": 120,
            'removeTimeout': 1,
            'fileTypeExts': '*.jpg; *.png; *.gif;',
            "onUploadSuccess": uploadPictureface,
            'onFallback': function () {
                alert('未检测到兼容版本的Flash.');
            }
        });
        function uploadPictureface(file, data) {
            var data = $.parseJSON(data);
            console.log(data);
            var src = '';
            if (data.status) {
                $("#cover_id_face").val(data.path);
                src = data.url || '__ROOT__' + data.path
                $("#cover_id_face").parent().find('.upload-img-box').html(
                        '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                        );
            } else {
                updateAlert(data.info);
                setTimeout(function () {
                    $('#top-alert').find('button').click();
                    $(that).removeClass('disabled').prop('disabled', false);
                }, 1500);
            }
        }
    </script>
</block>
